#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <stdint.h>
/* #define P(A,q) while(q>=0) fprintf(stderr,"%d", abs((A>>q--)%2));fprintf(stderr,"\n");q=31 */

void
printb(short x, register int8_t q)
{
	while (q >= 0)
		fprintf(stderr, "%d", abs( (x >> q--) % 2) );
	fprintf(stderr,"\n");
}

short
getbit(short x, short pos)
{
	return (x >> pos) & 1;
}


void
setbit(short* n, short pos, short bit)
{
	if (bit == 1)
		*n |= 1 << pos;
	else
		*n &= ~(1 << pos);
}


int
main(void)
{
	short in = 0, out = 0, prev = 2, pos = 7; /* prev keeps previous bits value */
	freopen("rle.in", "r", stdin);
	freopen("rle.out", "w", stdout);
	while (scanf("%hd", &in) == 1) {
		if (prev == 2) {
			prev = getbit(in, pos--); /* first run */
		} else {
			pos = 7;
		}
		while (pos >= 0) {
			if (getbit(in, pos) == prev && out + 1 != 1<<8 - 1) {
				++out;
				--pos;
			} else {
				setbit(&out, 7, prev);
				printf("%hd ", out);
#ifdef DEBUG
				fprintf(stderr, "out = %4hd = ", out);
				printb(out, 7);
#endif
				prev = getbit(in, pos); /* preparing for next loop */
				out = 0;
				--pos;
			}
		}
	}
	if (getbit(in, ++pos) == prev && out == 0 || out != 0) {
		setbit(&out, 7, prev);
		printf("%hd\n", out);
#ifdef DEBUG
		fprintf(stderr, "out = %4hd = ", out);
		printb(out, 7);
#endif
	} else {
		putchar('\n');
	}
	return 0;
}
